#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <string>
#include <random>
#include <vector>
#include <functional>

#include <ClanLib/core.h>
#include <ClanLib/display.h>
#include <ClanLib/gl.h>
#include <ClanLib/application.h>

using namespace std;

class Map
{
public:
	Map(void);
	~Map(void);

	void Initialize(int height, int width);
	void NextGeneration();
	void CheckCell(int x, int y, int neighbor_count);
	int GetNeighbor(int x, int y);
	void CopyCells(void);
	int *current_map, *next_map;
	void SetCell(int x, int y, int nextState);
	void ClearCell(int x, int y);
	void Calculate(void);
	int width, height;
	void ReadInputFile(string inputFileName);
	void Draw(CL_GraphicContext gc);
	int CellState(int x, int y);
	CL_Pointf drawCoordinates;


	bool CalculateNextState(int chance);

	enum State {FIRE = 0, TREE = 1, EMPTY = 2};
	enum Neighbors {LEFT, RIGHT, MIDDLE, TOP, BOTTOM, BL, BR, TL, TR};
};

